package day04

import java.net.InetAddress

/**
  * 关于在任务执行时对象的创建和序列化问题
  */

//第二种方式：像这种要传输数据
class Rules extends Serializable {
  val rulesMap = Map("xiaoli" -> 25, "xiaofang" ->22)
}

//第三种方式：单例对象。object修饰的类创建对象就是单例对象，直接val a = ObjectRules就得到单例对象
object ObjectRules extends Serializable {
  val rulesMap = Map("xiaoli" -> 25, "xiaofang" ->22)
}

//第四种方式：不需要实现序列化。因为不需要再Rriver端创建对象ObjectRules，我们直接用ObjectRules
/*
object ObjectRules extends Serializable {
  val rulesMap = Map("xiaoli" -> 25, "xiaofang" ->22)
  println("hostname名称为："+InetAddress.getLocalHost.getHostName)
}
*/
